package com.xy.annotaion.handler.interceptor;

import com.xy.annotaion.handler.annotation.TestLog;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * request mapping 拦截器 需要 在配置文件主动注册
 *
 * @author Dell
 */
//@Component//not OK!
public class TestHandlerInterceptor implements HandlerInterceptor {
    @Override
    @TestLog//OK
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        return true;
    }

    @Override
    @TestLog
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    }

    @Override
    @TestLog
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}
